package cn.itcast.java.reflect;

/**
 * Author itcast
 * Date 2021/10/11 15:32
 * Desc TODO
 */
public class Test {
    public static void main(String[] args) {
        Test t = new Test();

        t.printAnimal(new Animal() {
            @Override
            public void eat() {
                System.out.println("橘子");
            }
        });

        t.printAnimal(()->{
            System.out.println("吃苹果");
        });
    }

    public void printAnimal(Animal an){
        an.eat();
    }
}
